package com.pers.springcloud.myhandler;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.pers.springcloud.bean.JsonResultVo;

/**
 * @author huangjian
 */
public class CustomerBlockHandler {

    /**
     * blockHandler 参数与requestMapping的参数一致再加上BlockException
     * @param id
     * @param e
     * @return
     */
    public static JsonResultVo handlerException(Long id,BlockException e){
        return JsonResultVo.error("global handlerException 1");
    }

    public static JsonResultVo handlerException2(BlockException e){
        return JsonResultVo.error("global handlerException 2");
    }

    /**
     * fallBack 参数与requestMapping的参数一致再加上BlockException
     * @param id
     * @param throwable
     * @return
     */
    public static JsonResultVo forBackHandlerException(Long id,Throwable throwable){
        return JsonResultVo.error("forBack handlerException "+throwable.getMessage());
    }
}
